﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Collections;

namespace SSPharma.View.HeThong
{
    /// <summary>
    /// Interaction logic for FormSheet.xaml
    /// </summary>
    public partial class FormSheet : Window
    {
        //// add a delegate
        public delegate void IdentityUpdate(string ListID);
        //// add an event of the delegate type
        public event IdentityUpdate IdentityUpdated;
        public FormSheet()
        {
            InitializeComponent();
        }
        public FormSheet(List<string> list)
        {
            InitializeComponent();
            listSheet.ItemsSource = list;
        }
        private void btnSheet_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                // Find the right item and it's value
                string currentItemText = listSheet.SelectedValue.ToString();
                this.IdentityUpdated(currentItemText);
                this.Close();
            }
            catch (Exception ex) { }
        }
        private void listSheet_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            // Find the right item and it's value
            if (listSheet.Items.Count > 0 || listSheet != null)
            {
                try
                {
                    string currentItemText = listSheet.SelectedValue.ToString();
                    this.IdentityUpdated(currentItemText);
                    this.Close();
                }
                catch (Exception ex) { }
            }
        }

    }
}
